<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

class CoreInjection {
	var $_data;
	
	//constructor
	function CoreInjection() {
		$this->_data = array();
	}
	
	//methods
	function add($method, $param, $obj = '') {
		if( $obj == '' ) {
			//function call
			if( $param['name'] && $param['value'] ) {
				$this->_data['function'][$method][$param['name']][] = $param['value'];
			}
		} else {
			//method
		
		}
	}
	
	function addb($method, $param, $name, $value) {
		$this->_data['function'][$method][$param][] = array($name => $value);
	}
	
	function addcontent($name, $value) {
		$method = 'func_get_tpl_pagelayout_content';
		$param = 'content_wrap';
		$this->_data['function'][$method][$param][] = array($name => $value);
	}
	
	function addcontext($name, $value) {
		$method = 'func_get_tpl_pagelayout_content';
		$param = 'context_wrap';
		$this->_data['function'][$method][$param][] = array($name => $value);
	}
	
	//add Call
	//	1-----Front
	//	2-----Back
	//	3-----Contain
	function addCall($method, $param, $obj = '', $type = '1') {
		
	}
	
	function get($method, $param_name, $obj = '') {
		$data = array();
		
		if( $obj == '' ) {
			//function call
			if( $param_name ) {
				$data = $this->_data['function'][$method][$param_name];
			}
		} else {
			//method
		
		}
		
		return $data;
	}
	
	function clean() {
		$this->_data = array();
	}
	
	function remove($method, $param, $obj = '') {
		if( $obj == '' ) {
			//function call
			if( is_array($param) ) {
				if( $param['name'] ) {
					unset($this->_data['function'][$method][$param['name']]);
				}
			} else {
				unset($this->_data['function'][$method][$param]);
			}
		} else {
			//method
		
		}
	}
}
//
?>